package com.ys.timer;

import java.util.Date;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Controller;

import com.ys.entity.finance.TcwAccountDetailedForCompany;
import com.ys.service.business.TcwAccountDetailedForCompanyService;

@Controller
public class TimerTcwAccountDetailedForCompanyControlDaily {
	private static final Logger logger = LoggerFactory.getLogger(TimerTcwAccountDetailedForCompanyControlDaily.class);

	@Autowired
	private TcwAccountDetailedForCompanyService tcwAccountDetailedForCompanyService;


	@Scheduled(cron = "0 0 2 * * * ")
	public void updateTpAmazonShopOrderDaily() {
		System.out.println("刷新流水数据的运营信息---------" + new Date());
		
		tcwAccountDetailedForCompanyService.updateBatch();
	}



	//每天00:05:00收取，收取资金占用费
	@Scheduled(cron = "00 05 00 * * * ")
	public void fundOccupyCost() {
		try {
			logger.info("***********定时收取资金占用费开始***********");
			tcwAccountDetailedForCompanyService.fundOccupyCost();
			logger.info("***********定时收取资金占用费完成***********");
		}catch (Exception e){
			logger.error("定时收取资金占用费出错：",e.getMessage(),e);
		}
	}



	//每天00:01:01收取，收取占库费
	@Scheduled(cron = "00 01 01 * * * ")
	public void occupyInventoryCost() {
		try {
			logger.info("***********定时收取占库费开始***********");
			tcwAccountDetailedForCompanyService.occupyInventoryCost();
			logger.info("***********定时收取占库费完成***********");
		}catch (Exception e){
			logger.error("定时收取占库费出错：",e.getMessage(),e);
		}
	}

}
